package xd.ylwy.indicators.controller;


import com.baomidou.mybatisplus.extension.activerecord.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import xd.ylwy.indicators.entity.Average;
import xd.ylwy.indicators.entity.StudentNum;
import xd.ylwy.indicators.entity.TbIndicators;
import xd.ylwy.indicators.entity.WarningStudent;
import xd.ylwy.indicators.service.impl.TbIndicatorsServiceImpl;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xd
 * @since 2022-09-23
 */
@Controller
@RequestMapping("/tbIndicators")
public class TbIndicatorsController {
    @Autowired
    private TbIndicatorsServiceImpl tbIndicatorsService;

    @GetMapping("/warningFaculty")
    @ResponseBody
    public List<Map<String, Object>> warningFaculty(){
        return tbIndicatorsService.warningFaculty();
    }

    @GetMapping("/warningGrade")
    @ResponseBody
    public List<Map<String, Object>> warningGrade(){
        return tbIndicatorsService.warningGrade();
    }
    @GetMapping("/warningIntervene")
    @ResponseBody
    public List<Map<String, Object>> warningIntervene(){
        return tbIndicatorsService.warningIntervene();
    }

    @GetMapping("/average")
    @ResponseBody
    public Average average(){
        return tbIndicatorsService.average();
    }

    @GetMapping("/studentNum")
    @ResponseBody
    public StudentNum studentNum(){
        return tbIndicatorsService.studentNum();
    }

    @PostMapping ("/selectById")
    @ResponseBody
    public TbIndicators selectByID(@RequestParam String id){
        return tbIndicatorsService.selectByID(id);
    }
    @PostMapping ("/updateText")
    @ResponseBody
    public Boolean updateText(TbIndicators tbIndicators){
        return tbIndicatorsService.updateText(tbIndicators);
    }


    @GetMapping("/warningStudent")
    @ResponseBody
    public List<WarningStudent> warningStudent(){
        return tbIndicatorsService.warningStudent();
    }


}

